﻿/** \file
* \$Rev: 184 $
* 
* \$Date: 2010-04-14 07:18:41 +0000 (Wed, 14 Apr 2010) $
*
* \$URL: http://chorus-twitter.googlecode.com/svn/trunk/src/twitter/Account.cs $
*/

using System;
using System.Net;
using System.Xml.Serialization;

namespace chorus.twitter
{
	/// <summary>
	/// A Twitter user with authentication and rate limiting information.
	/// </summary>
	[XmlRoot("user")]
	public class Account : user
	{
		/// <summary>The user's password.</summary>
		string password;
		/// <summary>A placeholder account instance to indicate that no authentication is needed.</summary>
		public static readonly Account NoAuth = new Account();

		/// <summary>The static constructor. Set up NoAuth.</summary>
		static Account() { NoAuth.DisplayName = "(none)"; }

		/// <summary>Create a form to ask the user for a password for this account.</summary>
		public void RequestPassword()
		{
			gui.PasswordForm pass = new gui.PasswordForm();
			pass.AccountName = screen_name;
			pass.ShowDialog(Program.mainform);
			password = pass.Password;
		}

		/// <summary>A network credential object based on the auth information.</summary>
		public NetworkCredential Creds { get { return new NetworkCredential(screen_name, password); } }

		/// <summary>The rate information associated with this account.</summary>
		Rate rate;
		/*
		enum DeviceEnum
		{
			sms,
			im,
			none
		};

		DeviceEnum device;
		*/
	}
}
